package org.mixare.placesint;

import android.app.Activity;
import android.content.IntentSender.SendIntentException;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;

public abstract class LoginUsuarios extends Activity implements OnClickListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_login_usuarios);
		//criar botao google plus
		mPlusClient = new PlusClient.Builder(this, this, this)
				.setVisibleActivities("http://schemas.google.com/AddActivity",
						"http://schemas.google.com/BuyActivity").build();
	}

	private void carregarBotaoGooglePlus() {
		findViewById(R.id.buttonGooglePlus).setOnClickListener(
				(OnClickListener) this);
	}
	
	@Override
	public void onClick(View view) {
	    if (view.getId() == R.id.buttonGooglePlus && !mPlusClient.isConnected()) {
	        if (mConnectionResult == null) {
	            mConnectionProgressDialog.show();
	        } else {
	            try {
	                mConnectionResult.startResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR);
	            } catch (SendIntentException e) {
	                
	            	// Tente se conectar novamente.
	                mConnectionResult = null;
	                mPlusClient.connect();
	            }
	        }
	    }
	}
	
	public void onConnected(Bundle connectionHint) {
	    mConnectionProgressDialog.dismiss();
	    Toast.makeText(this, "User is connected!", Toast.LENGTH_LONG).show();
	}

	/*@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.login_usuarios, menu);
		return true;
	}*/

}
